<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://img.mukewang.com/down/540812440001e40e00000000.js" type="text/javascript"></script>
<title></title>
</head>
<body>

<script type="text/javascript">


function show(data) {
  $("body").append('<li>' + data + '</li>')
}

var Observable = {
  callbacks: [],
  add: function(fn) {
    this.callbacks.push(fn);
  },
  fire: function() {
    this.callbacks.forEach(function(fn) {
      fn();
    })
  }
}

//使用add开始订阅：
Observable.add(function() {
  show('订阅慕课网jquery教程上')
})
Observable.add(function() {
 show('订阅慕课网jquery教程下')
})


//使用fire发布慕课网的jQuery教程
Observable.fire(); 


</script>

</body>
</html>















